package com.jctrip.hotel.route.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.jctrip.hotel.common.annotation.RedisLimitAnnotation;
import com.jctrip.hotel.route.model.result.Result;

import lombok.extern.slf4j.Slf4j;

/**
 * 健康检查接口
 */
@Slf4j
@RestController
@RequestMapping("")
public class HealthController {

    @GetMapping("/health/check")
    public Result<?> healthCheck() {
        try {
            return Result.ok();
        } catch (Exception e) {
            log.error(e.getMessage(), e);
            return Result.error(e.getMessage());
        }
    }

    @GetMapping("request/limit/demo")
    @RedisLimitAnnotation(key = "limit-test")
    public Result test() {
        try {
            return Result.ok();
        } catch (Exception e) {
            log.error(e.getMessage(), e);
            return Result.error(e.getMessage());
        }
    }
}
